From e1ae548d4277b16b9897b64e45f309f9c9523bf3 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 28 May 2009 11:01:00 +0100 Subject: [PATCH] blktap2: Fix build with gcc3. Cannot handle defining a function which is passed a struct-by-value which is not yet fully defined. Thus defining a request struct which contains a pointer to a function which is passed-by-value an instance of that request structure is impossible. We work around it by defining the function poiinter as void* and then casting in one place. Signed-off-by: Keir Fraser --- tools/blktap2/drivers/tapdisk-interface.c | 2 +- tools/blktap2/drivers/tapdisk.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/blktap2/drivers/tapdisk-interface.c b/tools/blktap2/drivers/tapdisk-interface.c index 58366d0a0b..fedb17a3aa 100644 --- a/tools/blktap2/drivers/tapdisk-interface.c +++ b/tools/blktap2/drivers/tapdisk-interface.c @@ -213,7 +213,7 @@ td_forward_request(td_request_t treq) void td_complete_request(td_request_t treq, int res) { - treq.cb(treq, res); + ((td_callback_t)treq.cb)(treq, res); } void diff --git a/tools/blktap2/drivers/tapdisk.h b/tools/blktap2/drivers/tapdisk.h index 487c50fbf6..1147ab3580 100644 --- a/tools/blktap2/drivers/tapdisk.h +++ b/tools/blktap2/drivers/tapdisk.h @@ -104,11 +104,6 @@ typedef struct td_request td_request_t; typedef struct td_driver_handle td_driver_t; typedef struct td_image_handle td_image_t; -/* - * Prototype of the callback to activate as requests complete. - */ -typedef void (*td_callback_t)(td_request_t, int); - struct td_disk_id { char *name; int drivertype; @@ -130,7 +125,7 @@ struct td_request { td_image_t *image; - td_callback_t cb; + void * /*td_callback_t*/ cb; void *cb_data; uint64_t id; @@ -138,6 +133,11 @@ struct td_request { void *private; }; +/* + * Prototype of the callback to activate as requests complete. + */ +typedef void (*td_callback_t)(td_request_t, int); + /* * Structure describing the interface to a virtual disk implementation. * See note at the top of this file describing this interface. -- 2.30.2